﻿@using Nop.Core.Domain.Customers
@using Telerik.Web.Mvc.UI;
@using Nop.Web.Framework.UI;
@using Nop.Core;
@using Nop.Services.Security;
@{
    var currentCustomer = this.WorkContext.CurrentCustomer;
    var usernamesEnabled = EngineContext.Current.Resolve<Nop.Core.Domain.Customers.CustomerSettings>().UsernamesEnabled;

    //resources
    Html.AppendCssFileParts("~/subsites/Administration/Content/styles.css");
    Html.AppendScriptParts("~/subsites/Administration/Scripts/admin.common.js");
    Html.AppendScriptParts("~/subsites/Administration/Scripts/jquery.validate.unobtrusive.min.js");
    Html.AppendScriptParts("~/subsites/Administration/Scripts/jquery.validate.min.js");
    Html.AppendScriptParts("~/subsites/Administration/Scripts/jquery.unobtrusive-ajax.min.js");

    //page title
    string adminPageTitle = "";
    if (!String.IsNullOrWhiteSpace(ViewBag.Title))
    {
        adminPageTitle = ViewBag.Title + " / ";
    }
    adminPageTitle += T("Admin.PageTitle").Text;

    //has "Manage Maintenance" permission?
    var canManageMaintenance = EngineContext.Current.Resolve<IPermissionService>()
        .Authorize(StandardPermissionProvider.ManageMaintenance);
}
<!DOCTYPE html>
<html>
<head>
    <title>@adminPageTitle</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    @*<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>*@
    <script>window.jQuery || document.write('<script src="/Scripts/jquery-1.7.2.min.js"><\/script>')</script>
    @*<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>*@
    <script>window.jQuery.ui || document.write('<script src="/Scripts/jquery-ui-1.10.2.min.js"><\/script>')</script>

    <link rel="apple-touch-icon" sizes="57x57" href="/content/images/favicon/apple-touch-icon-57x57.png?v=LbbWkEmr9b">
    <link rel="apple-touch-icon" sizes="60x60" href="/content/images/favicon/apple-touch-icon-60x60.png?v=LbbWkEmr9b">
    <link rel="apple-touch-icon" sizes="72x72" href="/content/images/favicon/apple-touch-icon-72x72.png?v=LbbWkEmr9b">
    <link rel="apple-touch-icon" sizes="76x76" href="/content/images/favicon/apple-touch-icon-76x76.png?v=LbbWkEmr9b">
    <link rel="icon" type="image/png" href="/content/images/favicon/favicon-32x32.png?v=LbbWkEmr9b" sizes="32x32">
    <link rel="icon" type="image/png" href="/content/images/favicon/favicon-16x16.png?v=LbbWkEmr9b" sizes="16x16">
    <link rel="manifest" href="/content/images/favicon/manifest.json?v=LbbWkEmr9b">
    <link rel="shortcut icon" href="/favicon.ico?v=LbbWkEmr9b">
    <meta name="msapplication-TileColor" content="#da532c">
    <meta name="theme-color" content="#ffffff">

    @Html.NopCssFiles(this.Url, ResourceLocation.Head)
    @Html.NopScripts(this.Url, ResourceLocation.Head)
</head>
<body>
    <div class="master-wrapper-page">
        <div class="master-wrapper-content">
            @if (IsSectionDefined("header"))
            {
                @RenderSection("header")
            }
            else
            {
                <script type="text/javascript">
                    $(document).ready(function () {
                        $("#restart-application").click(function (e) {
                            showThrobber('@T("Admin.Header.RestartApplication.Progress")');
                        });
                    });
                </script>
                <div class="header">
                    <div class="logo">
                        <a href="@Url.RouteUrl("HomePage")"><img src="~/Content/images/spotshub-new-logo.png"></a>
                    </div>
                    @Html.Widget("admin_header_before")
                    <div class="languageselector">
                        @Html.Action("LanguageSelector", "Common")
                    </div>
                    @Html.Widget("admin_header_middle")
                    <div class="links">
                        @Html.RouteLink(T("Admin.Header.PublicStore").Text, "HomePage")
                        @if (canManageMaintenance)
                        {
                            <span class="separator">|</span>
                            @Html.ActionLink(T("Admin.Header.ClearCache").Text, "ClearCache", "Common")
                            <span class="separator">|</span>
                            @Html.ActionLink(T("Admin.Header.RestartApplication").Text, "RestartApplication", "Common", null, new { id = "restart-application" })
                        }
                    </div>
                    <div class="login-info">
                        @if (currentCustomer != null && currentCustomer.IsRegistered())
                        {
                            @String.Format(T("Admin.Header.LoggedInAs").Text, usernamesEnabled ? currentCustomer.Username : currentCustomer.Email)
                            <text>, </text> @Html.RouteLink(T("Admin.Header.Logout").Text, "Logout")
                        }
                    </div>
                    @Html.Widget("admin_header_after")
                </div>
                <div class="clear">
                </div>
            }
            @if (IsSectionDefined("headermenu"))
            {
                @RenderSection("headermenu")
            }
            else
            {
                <div class="header-menu">
                    @Html.Partial("Menu")
                </div>
            }
            @if (IsSectionDefined("statusbar"))
            {
                @RenderSection("statusbar")
            }
            else
            {
                <div class="status-bar">
                    <div class="help">
                        @(EngineContext.Current.Resolve<Nop.Services.Helpers.IDateTimeHelper>().ConvertToUserTime(DateTime.UtcNow, DateTimeKind.Utc).ToString("f"))
                    </div>
                    <div class="breadcrumb">
                        <!-- SiteMapPath here-->
                        @Html.Widget("admin_breadcrumb")
                    </div>
                </div>
                <div class="clear">
                </div>
            }
            <div class="content">
                @Html.Partial("Notifications")
                <div class="cph">
                    @RenderBody()
                </div>
            </div>
            <div class="throbber">
                <div class="curtain">
                </div>
                <div class="curtain-content">
                    <div>
                        <h1 class="throbber-header">Wait...</h1>
                        <p>
                            <img src="@Url.Content("~/subsites/Administration/content/images/throbber-synchronizing.gif")" alt="" />
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--These need to be at the end of the page to ensure that all the controls requiring scripts have been rendered-->
    @(Html.Telerik().StyleSheetRegistrar()
        .DefaultGroup(group => group
            .Add("telerik.common.min.css")
            .Add("telerik.vista.min.css")
            .Add("telerik.rtl.min.css")
            //uncomment the lines below in order to combine and compress CSS files
            //.Combined(true)
            //.Compress(true)
            ))
    @(Html.Telerik().ScriptRegistrar()
            .jQuery(false)
            .jQueryValidation(false)
    )
    @Html.NopCssFiles(this.Url, ResourceLocation.Foot)
    @Html.NopScripts(this.Url, ResourceLocation.Foot)
</body>
</html>
